<style>
    .up_input {
    position: absolute;
    opacity:0;
    z-index: 2
    }
</style>
<script type="text/javascript">
    function checkFile(_file) {
        var name = $("input[name='modelfile']",_file).val();
        if(!name){
            alertMsg.info("<@label key='CheckFile_null_msg.D'>请选择文件后再上传!</@label>");
            return false;
        }
        var extend = name.substring(name.lastIndexOf(".") + 1);    
        if(!(extend=="bpmn" || extend == "xml")){
            alertMsg.info("<@label key='export_processModel.D'>请上传一个包含图片信息（用于坐标定位）的文件 (.bpmn20.xml 或 .bpmn)。</@label>");
            return false;
        }
        return iframeCallback(_file,dialogAjaxDone);
    }

    function extractFilename(path) {
      var x;
      x = path.lastIndexOf('\\');
      if (x >= 0) // 基于Windows的路径
        return path.substr(x+1);
      x = path.lastIndexOf('/');
      if (x >= 0) // 基于Unix的路径
        return path.substr(x+1);
      return path; // 仅包含文件名
    }
    $("input#import_fileupload").change(function() {
        $("dd#show_fileName").html(extractFilename(this.value));
    });
</script>
<div class="pageContent" id="import_pagecontent">
    <form method="post" action="${rc.getContextPath()}/manage/model/importModel" enctype="multipart/form-data" class="pageForm required-validate" target = "callbackframe" onsubmit="return checkFile(this);">
    <div class="pageFormContent" layoutH="56">
    
        <input type="hidden" name="category" value="${category!''}" />
        <input type="hidden" name="navTabId" value="${navTabId!''}" />
        <div class="pageFormContent">
            <fileset>
                <dl class="nowrap"><dt><input name="modelfile" type="file" id="import_fileupload" class="up_input" accept=".bpmn,.xml" />
                <div style="height: 24px; z-index: 1;line-height: 24px; width: 80px;float: left;" id="import_fileupload-button" class="uploadify-button my-uploadify">
                    <span class="uploadify-button-text">选择文件</span>
                </div></dt>
                <dd id="show_fileName"></dd>
                </dl>
                <dl class="nowrap"><@label key='export_processModel.D'>请上传一个包含图片信息（用于坐标定位）的文件 (.bpmn20.xml 或 .bpmn)。</@label></dl>
            </fileset>
        </div>
    </div>
    <div class="formBar">
        <ul>
            <li><div class="buttonActive" id="processOperation_save"><div class="buttonContent"><button type="submit"><@label key="save.B">保存</@label></button></div></div></li>
            <li>
                <div class="buttonActiveGrey"><div class="buttonContent"><button type="button" class="close"><@label key="cancel.B">取消</@label></button></div></div>
            </li>
        </ul>
    </div>
    </form>
</div>
    
    <iframe id='callbackframe' name='callbackframe' src='about:blank'"  style="display:none"></iframe>